package edu.ynu.se.xiecheng.achitectureclass.GreenHouse.GreenhouseDao;


import edu.ynu.se.xiecheng.achitectureclass.GreenHouse.GreenhouseEntity.Token;
import edu.ynu.se.xiecheng.achitectureclass.common.dao.LogicDAO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TokenDAO extends LogicDAO<Token, Long> {
    // 可以根据需要添加自定义查询方法
    @Query("SELECT t FROM Token t WHERE t.tokenValue = ?1 ORDER BY t.updateTime DESC")
    List<Token> findByTokenValue(String tokenValue);

    // 根据 tokenType 查找最新的 Token
    @Query("SELECT t FROM Token t WHERE t.tokenType = ?1 ORDER BY t.updateTime DESC")
    List<Token> findByTokenType(String tokenType);
}